package com.woniu.market_stall_web.mapper;

import com.woniu.market_stall_web.entity.Stall;
import com.woniu.market_stall_web.vo.AuctionStallVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface StallMapper {
    int deleteByPrimaryKey(Integer stallId);

    int insert(Stall record);

    Stall selectByPrimaryKey(Integer stallId);

    List<Stall> selectAll();

    int updateByPrimaryKey(Stall record);

    @Select("SELECT * FROM stall WHERE status=0 and stall_type=1 and DATEDIFF(p_startAuction_time,NOW())<7 AND DATEDIFF(p_startAuction_time,NOW())>=0")
    List<Stall> showRecommend();
    @Select("SELECT * FROM stall WHERE status=0 and stall_type=0")
    List<Stall> showAllRent();

    List<AuctionStallVo> selectAuctioning();

    List<AuctionStallVo> selectAuctioningOneStall(@Param(value = "stallId") int stallId);

    int updateAuctionStallStatus(@Param(value = "stallId") int stallId ,@Param(value = "userId") int userId);


    int modifyAuctionStallStatus(int stallId);

    int modifyAuctionStallJoinCount(@Param(value = "count")int count , @Param(value = "stallId") int stallId);
}